package personal.xjl._23java1studentdemo.mapper;

import org.apache.ibatis.annotations.*;
import personal.xjl._23java1studentdemo.model.Course;
import personal.xjl._23java1studentdemo.model.Student;
import personal.xjl._23java1studentdemo.model.Teacher;

import java.util.List;

@Mapper
public interface CourseMapper {
    @Select("select * from course")
    @Results({
            @Result(column = "teacher_id",property = "teacher",javaType = Teacher.class,
            one = @One(select = "package personal.xjl._23java1studentdemo.mapper.TeacherMapper.selectById"))
    })
    List<Course> selectAll();
    @Select("select * from course limit #{fromIndex},#{pageSize}")
    List<Course> selectByPage(int fromIndex, int pageSize);
    @Select("select * from course where id=#{id}")
    Course selectById(int id);
}
